/* Copyright (c) 2004-2024 Peigen.info. All rights reserved. */

package info.peigen.hotpot.demo.repository.tdengine.mapper;

import info.peigen.hotpot.component.data.repository.beetlsql.mapper.AbstractBeetlSqlMapper;
import info.peigen.hotpot.demo.repository.tdengine.entity.DogEntity;
import org.beetl.sql.mapper.annotation.Select;
import org.beetl.sql.mapper.annotation.Sql;
import org.beetl.sql.mapper.annotation.Update;

import java.util.List;

/**
 * <b>(DogMapper)</b>
 *
 * @author Peigen
 * @version 1.0.0
 * @since 2022/8/1
 */
@SuppressWarnings("AlibabaAbstractMethodOrInterfaceMethodMustUseJavadoc")
public interface DogMapper extends AbstractBeetlSqlMapper<DogEntity> {
    @Sql("drop table if exists pet")
    @Update
    void dropSuperTable();

    @Sql("CREATE TABLE if not exists pet(ts timestamp, name nchar(10),age int) tags(zoo_name nchar(10))")
    @Update
    int createSuperTable();

    @Sql("create table dog using pet tags('zhaomushan')")
    @Update
    int createTable();

    @Sql("select * from dog where name=#{name}")
    @Select
    List<DogEntity> findByName(String name);

    @Sql("delete from dog where name=#{name}")
    @Update
    void deleteByName(String name);
}